<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Usuario extends CI_Controller {
	function __construct(){
		parent::__construct();
		$this->load->model('usuario_model');
	}
	public function buscarNombreUsuario(){
		$bool = true;
		$name_user = $this->input->post('usuario');
		$bool = $this->usuario_model->buscarUsuario($name_user);
		if ($bool)
			$tirajson = '{ "success": "true", "message": "Nombre de usuario no disponible / User name not available" }';
		else
			$tirajson = '{ "success": "false", "message": "ID disponible/ID available" }';
		
		echo $tirajson;
	}
	
	public function validarPassword(){
		$usuario = $this->input->post('usuario');
		$password = $this->input->post('password');
		$bool = $this->usuario_model->verificarPassword($usuario, $password);
		if ($bool)
			$tirajson = '{ "success": "true", "exito": "true", "message": "Password confirmado exitosamente" }';
		else
			$tirajson = '{ "success": "true", "exito": "false", "message": "Password no confirmado" }';
		
		echo $tirajson;
	}
}
